/**
 * 
 */
package countzr.mightylighting;

import countzr.mightylighting.block.NeonStarterBlock;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.Configuration;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

/**
 * @author countzr@gmail.com
 * @see list des tutos http://www.minecraftforge.net/wiki/Category:Tutorials
 *
 */
@Mod(modid="mightylighting", name="Mightylighting", version="0.1.0")
public class Mightylighting {
	
	// The instance of your mod that Forge uses.
	@Instance("mightylighting")
	public static Mightylighting instance;

	@SidedProxy(clientSide="countzr.mightylighting.client.ClientProxy", serverSide="countzr.mightylighting.server.ServerProxy")
	public static CommonProxy proxy;

	public static CreativeTabs mightylightingTab = new MightylightingCreativeTab("mightylightingTab");

	public Configuration configuration;

	@PreInit
	public void preInit(FMLPreInitializationEvent event) {
		configuration = new Configuration(event.getSuggestedConfigurationFile());
		configuration.load();
	}

	@Init
	public void load(FMLInitializationEvent event) {
		
		// Ajout des blocks
		int neonStarterBlockId=configuration.getBlock(NeonStarterBlock.CONFIGURATION_KEY, NeonStarterBlock.DEFAULT_ID).getInt();
		Block neonStarterBlock = new NeonStarterBlock(neonStarterBlockId).setCreativeTab(mightylightingTab);
		GameRegistry.registerBlock(neonStarterBlock, NeonStarterBlock.BLOCK_NAME);

		// Ajout du tab creative
		LanguageRegistry.instance().addStringLocalization("itemGroup.mightylightingTab", "en_US", "Mightylighting Tab");

		// enregistrement de la configuration
		configuration.save();
		
		proxy.registerRenderers();
	}

	@PostInit
	public void postInit(FMLPostInitializationEvent event) {
		// Stub Method
		configuration.save();
	}


	// -------------------------------------------------------------
	// BLOCK
	// -------------------------------------------------------------




}
